<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="/template.xhtml">
	<ui:define name="css">
		<style type="text/css">
.ui-picklist .ui-picklist-list {
	height: 230px;
	list-style-type: none;
	margin: 0;
	overflow: auto;
	padding: 0;
	width: 330px;
}
</style>
	</ui:define>
	<ui:define name="tituloPagina">
		<p:outputLabel value="#{msgs['paginas.cadastro.titulo.compromissos']}" />
	</ui:define>

	<ui:define name="principal">


		<p:ajaxStatus onstart="PF('statusDialog').show();"
			onsuccess="PF('statusDialog').hide();" id="status">


			<p:dialog modal="true" widgetVar="statusDialog" draggable="false"
				closable="false" resizable="false" style="border: none; !important">
				<p:graphicImage value="/imagens/gif.gif">
				</p:graphicImage>
			</p:dialog>

		</p:ajaxStatus>




		<p:dialog id="basicDialog" style="width: 2000px;" widgetVar="dialog"
			resizable="false" header="Participantes da Reunião">


			<p:pickList value="#{compromissoBean.dualListModel}" var="pessoa"
				itemValue="#{pessoa}" itemLabel="#{pessoa}" showCheckbox="true"
				showTargetFilter="true" filterMatchMode="contains"
				showSourceFilter="true">

				<f:facet name="sourceCaption">Todos</f:facet>
				<f:facet name="targetCaption">Selecionados</f:facet>

			</p:pickList>

			<p:commandButton value="#{msgs['botoes.adicionar']}"
				action="#{compromissoBean.adicionarPaticipanteReuniao()}"
				ajax="false"></p:commandButton>


		</p:dialog>

		<p:panelGrid columns="2" class="formularioCompromissosAtual">
			<p:outputLabel value="#{msgs['campos.titulo.reuniao']}" />


			<p:outputLabel value="#{compromissoBean.compromisso.reuniao.nome}"
				disabled="true">
				<f:convertDateTime pattern="dd/MM/yyyy HH:mm" timeZone="GMT-03:00" />
			</p:outputLabel>

			<p:outputLabel value="#{msgs['campos.titulo.numero.compromisso']}" />

			<p:outputLabel value="#{compromissoBean.gerarNumeroCompromisso()}"
				disabled="true" id="numero" />



			<p:outputLabel value="#{msgs['campos.titulo.prazo.conclusao']}" />

			<p:calendar id="popupButtonCal" showOn="button"
				value="#{compromissoBean.compromisso.metaConclusao}" locale="pt_BR">
			</p:calendar>

			<p:outputLabel value="#{msgs['campos.titulo.solicitante']}" />

			<p:selectOneMenu
				value="#{compromissoBean.compromisso.solicitante.id}"
				style="width: 226px;" id="solicitante">

				<f:selectItems value="#{compromissoBean.listapessoas}">
				</f:selectItems>
			</p:selectOneMenu>

			<p:outputLabel value="#{msgs['campos.titulo.responsavel']}" />

			<p:autoComplete value="#{compromissoBean.stringResponsavel}"
				completeMethod="#{compromissoBean.complete}" queryDelay="700" required="true"
				id="responsavel"></p:autoComplete>


			<p:outputLabel value="#{msgs['campos.titulo.projeto']}" />

			<p:selectOneMenu value="#{compromissoBean.compromisso.projeto.id}"
				style="width: 226px;" required="false" id="projeto">
				<f:selectItem itemLabel="#{msgs['campos.combobox.selecione']}"
					itemValue=""></f:selectItem>
				<f:selectItems value="#{compromissoBean.listaprojetos}">
				</f:selectItems>
			</p:selectOneMenu>

			<p:outputLabel value="#{msgs['campos.titulo.descricao']}" />

			<p:inputTextarea rows="3" style="width: 225px;" maxlength="255"
				id="descricao" autoResize="false"
				value="#{compromissoBean.compromisso.descricao}" />
		</p:panelGrid>



		<!-- DataTable com os Compromissos da Reunião -->


		<p:dataTable value="#{compromissoBean.listaCompromissoAtual}"
			var="_lista" paginator="true" rows="5" class="listaCompromissosAtual"
			id="dataTable">



			<p:column headerText="#{msgs['campos.titulo.prazo.conclusao']}">
				<p:outputLabel value="#{_lista.metaConclusao}">
					<f:convertDateTime pattern="dd/MM/yyyy" timeZone="GMT-03:00" />

				</p:outputLabel>
			</p:column>

			<p:column headerText="#{msgs['campos.titulo.responsavel']}">
				<p:outputLabel value="#{_lista.pessoa.nome}" />
			</p:column>




			<p:column headerText="#{msgs['campos.titulo.descricao']}">
				<p:outputLabel value="#{_lista.descricao}" />
			</p:column>



			<p:column headerText="Ações">
				<p:commandButton icon="ui-icon-pencil" ajax="false"
					action="#{compromissoBean.editar}">
					<f:setPropertyActionListener
						target="#{compromissoBean.compromisso}" value="#{_lista}" />
				</p:commandButton>


				<p:commandButton icon="ui-icon-trash"
					action="#{compromissoBean.excluir}" ajax="false">
					<f:setPropertyActionListener
						target="#{compromissoBean.compromisso}" value="#{_lista}" />
				</p:commandButton>

			</p:column>
		</p:dataTable>


	</ui:define>
	<ui:define name="botoes">
		<p:commandButton value="#{msgs['botoes.salvar']}"
			action="#{compromissoBean.salvar()}"
			update="numero,popupButtonCal,solicitante,responsavel,projeto,descricao,dataTable,growl1"
			ajax="false" />

		<p:commandButton onclick="PF('dialog').show();"
			icon="ui-icon-plusthick" value="Adicionar Participante" />

		<p:commandButton value="Cancelar" action="#{compromissoBean.cancelar}" immediate="true"
			ajax="false" />
	</ui:define>
</ui:composition>
</html>